//
//  NYUserRegisterForm.m
//  NYTYY
//
//  Created by MinLison on 2017/12/12.
//  Copyright © 2017年 NYtyy. All rights reserved.
//

#import "NYUserRegisterForm.h"
#import "NYUserFormButtonCell.h"
#import "NYUserAgreementCell.h"
#import "NYUserFormPhoneCell.h"
#import "NYUserFormSMSCell.h"
#import "NYUserRegisterSubmitCell.h"
#import "NYUserPwdCell.h"
#import "NYUserFormUserRegisterCell.h"


@implementation NYUserRegisterForm

- (NSArray *)fields
{
        return @[
                 @{FXFormFieldKey : @keypath(self,mobile), FXFormFieldTitle : @"", FXFormFieldCell : [NYUserFormPhoneCell class], FXFormFieldPlaceholder : @"请输入手机号码"},
                 @{FXFormFieldKey : @keypath(self,sms_code), FXFormFieldTitle : @"", FXFormFieldCell : [NYUserFormSMSCell class], FXFormFieldPlaceholder : @"请输入验证码",FXFormFieldAction: @"getSmsCode"},
                 @{FXFormFieldKey : @keypath(self,password), FXFormFieldTitle : @"", FXFormFieldCell : [NYUserPwdCell class], FXFormFieldPlaceholder : @"请输入密码"},
                 ];
}
- (void)setMobile:(NSString *)mobile
{
        _mobile = mobile;
        NYUserManager.mobile = mobile;
}
- (void)setSms_code:(NSString *)sms_code
{
        _sms_code = sms_code;
        NYUserManager.sms_code = sms_code;
}
- (void)setPassword:(NSString *)password
{
        _password = password;
        NYUserManager.password = password;
}
- (void)setAgreement:(BOOL)agreement
{
        _agreement = agreement;
        NYUserManager.checkAgreement = agreement;
}
- (NSArray *)extraFields
{
        return @[
                 @{FXFormFieldKey : @"userRegister", FXFormFieldTitle : @"注册", FXFormFieldCell : [NYUserRegisterSubmitCell class], FXFormFieldAction: @"userRegister"},
                 @{FXFormFieldKey : @"userLogin", FXFormFieldTitle : @"您已有账号，立即去登录>", FXFormFieldCell : [NYUserFormUserRegisterCell class], FXFormFieldAction: @"userLogin"}
                 ];
}

- (void)dealloc
{
        NYUserManager.sms_code = nil;
        NYUserManager.checkAgreement = NO;
}
@end
